//
// Created by luolijun on 2021/11/1.
//

#ifndef FACADEPROTOTYPEREPOIMPL_H
#define FACADEPROTOTYPEREPOIMPL_H

#include "falcon/facade.h"

#include <list>
#include <map>

namespace falcon {

class FacadePrototypeRepoImpl : public FacadePrototypeRepo {
public:
    FacadePrototypeRepoImpl();
    virtual ~FacadePrototypeRepoImpl() override;
    virtual int32_t registerPrototype(std::string groupName, Facade* fc) override;
    virtual void enumPrototypeGroup(std::function<int(std::string groupName)> callback) override;
    virtual void enumPrototype(std::string groupName, std::function<int(Facade* fc)> callback) override;
    virtual Facade* clonePrototype(int32_t tmplId, std::string name, int32_t id) override;

private:
    std::map<int32_t, Facade*> prototypes;
    std::map<std::string, std::list<int32_t>> groups;
    int32_t baseid;
};

} // namespace falcon
#endif // FACADEPROTOTYPEREPOIMPL_H
